package com.lipi.mall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lipi.common.to.mq.SeckillOrderTO;
import com.lipi.common.utils.PageUtils;
import com.lipi.mall.order.entity.OrderEntity;
import com.lipi.mall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author hecy
 * @email kuanih200@163.com
 * @date 2021-06-14 16:09:46
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 生成确认订单页数据
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    OrderConfirmVO confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 创建订单
     * @return
     * @param vo
     */
    SubmitOrderResponseVO submitOrder(OrderSubmitVO vo);

    OrderEntity getOrderByOrderSn(String orderSn);

    void closeOrder(OrderEntity entity);

    /**
     * 封装支付数据,用以移交支付宝
     * @param orderSn
     * @return
     */
    PayVO getOrderPay(String orderSn);

    /**
     * 分页查询当前登录用户的订单列表
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String,Object> params);

    /**
     * 支付宝异步回调请求,验签成功后业务方法
     * @param vo
     * @return
     */
    String handlePayResult(PayAsyncVO vo);

    /**
     * 创建秒杀单订单
     * @param orderTO
     */
    void createSeckillOrder(SeckillOrderTO orderTO);
}

